/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package deti.es.ukni.persistence.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author eurico
 */
@Entity
@Table(name = "EVENT")
@NamedQueries({@NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"), @NamedQuery(name = "Event.findByIdevent", query = "SELECT e FROM Event e WHERE e.idevent = :idevent"), @NamedQuery(name = "Event.findByEventdate", query = "SELECT e FROM Event e WHERE e.eventdate = :eventdate"), @NamedQuery(name = "Event.findByLocation", query = "SELECT e FROM Event e WHERE e.location = :location"), @NamedQuery(name = "Event.findByLatitude", query = "SELECT e FROM Event e WHERE e.latitude = :latitude"), @NamedQuery(name = "Event.findByLongitude", query = "SELECT e FROM Event e WHERE e.longitude = :longitude"), @NamedQuery(name = "Event.findByDatecreation", query = "SELECT e FROM Event e WHERE e.datecreation = :datecreation")})
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDEVENT")
    private Integer idevent;
    @Basic(optional = false)
    @Column(name = "EVENTDATE")
    @Temporal(TemporalType.DATE)
    private Date eventdate;
    @Basic(optional = false)
    @Column(name = "LOCATION")
    private String location;
    @Basic(optional = false)
    @Column(name = "LATITUDE")
    private double latitude;
    @Basic(optional = false)
    @Column(name = "LONGITUDE")
    private double longitude;
    @Basic(optional = false)
    @Column(name = "DATECREATION")
    @Temporal(TemporalType.DATE)
    private Date datecreation;
    @ManyToMany(mappedBy = "eventCollection", fetch = FetchType.EAGER)
    private Set<Band> bandCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "event", fetch = FetchType.EAGER)
    private Set<CommentEvent> commentEventCollection;

    public Event() {
    }

    public Event(Integer idevent) {
        this.idevent = idevent;
    }

    public Event(Integer idevent, Date eventdate, String location, double latitude, double longitude, Date datecreation) {
        this.idevent = idevent;
        this.eventdate = eventdate;
        this.location = location;
        this.latitude = latitude;
        this.longitude = longitude;
        this.datecreation = datecreation;
    }

    public Integer getIdevent() {
        return idevent;
    }

    public void setIdevent(Integer idevent) {
        this.idevent = idevent;
    }

    public Date getEventdate() {
        return eventdate;
    }

    public void setEventdate(Date eventdate) {
        this.eventdate = eventdate;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public Date getDatecreation() {
        return datecreation;
    }

    public void setDatecreation(Date datecreation) {
        this.datecreation = datecreation;
    }

    public Set<Band> getBandCollection() {
        return bandCollection;
    }

    public void setBandCollection(Set<Band> bandCollection) {
        this.bandCollection = bandCollection;
    }

    public Set<CommentEvent> getCommentEventCollection() {
        return commentEventCollection;
    }

    public void setCommentEventCollection(Set<CommentEvent> commentEventCollection) {
        this.commentEventCollection = commentEventCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idevent != null ? idevent.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Event)) {
            return false;
        }
        Event other = (Event) object;
        if ((this.idevent == null && other.idevent != null) || (this.idevent != null && !this.idevent.equals(other.idevent))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "deti.es.ukni.persistence.entity.Event[idevent=" + idevent + "]";
    }

}
